package com.china08.yxyapi.schedule.mistakes;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.china08.yxyapi.service.mg.impl.TeaMistakesKnowServiceImpl;
import com.china08.yxyapi.service.mg.impl.TeaMistakesQuesServiceImpl;
import com.china08.yxyapi.util.YxyScheduleRunnableUtil;

@Component
public class TeaMistakesQuesStatisticsTask {

    @Autowired
    TeaMistakesQuesServiceImpl teaMistakesQuesServiceImpl;

    @Autowired
    TeaMistakesKnowServiceImpl teaMistakesKnowServiceImpl;

    private static final Logger log = LoggerFactory.getLogger(TeaMistakesQuesStatisticsTask.class);

    /**
     * 同步教师下班级的错题信息
     */
    @Scheduled(cron = "10 0/4 * * * ?")
    public void mistakesQuesTask() {

        // ##
        // 检测定时任务是否可执行
        if (!YxyScheduleRunnableUtil.checkRunnable()) { return; }

        teaMistakesQuesServiceImpl.teaMistakesQuesStatistics();
        teaMistakesKnowServiceImpl.synchMistakesKnow();
    }
}
